package com.zhang.passer.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhang.passer.domain.JingDo;
import com.zhang.passer.service.JingService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 页面处理器
 */
@Controller
@RequestMapping("/jing")
public class JingController {

    @Autowired
    JingService jingService;

    @RequestMapping("/queryByPage")
    @ResponseBody
    public Page<JingDo> queryByPage(int currentPage, int pageSize){
        //todo 2021/11/7 设置查询参数
        QueryWrapper<JingDo> queryWrapper = new QueryWrapper<>();

        //返回pageBean(Mybatis_plus中简单的分页模型)
        return jingService.selectPage(currentPage,pageSize, queryWrapper);
    }


    @RequestMapping("/queryDetail")
    @ResponseBody
    public JingDo queryDetail(@Param("id") int id){
        return jingService.queryDetail(id);
    }

}
